<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <table border="1">

        <tbody>
            <tr>
                <td>0,0</td>
                <td>0,1</td>
                <td>0,2</td>
                <td>0,3</td>
                <td>0,4</td>
                <td>0,5</td>
            </tr>
            <tr>
                <td>1,0</td>
                <td>1,1</td>
                <td>1,2</td>
                <td>1,3</td>
                <td>1,4</td>
                <td>1,5</td>
            </tr>
            <tr>
                <td>2,0</td>
                <td>2,1</td>
                <td>2,2</td>
                <td>2,3</td>
                <td>2,4</td>
                <td>2,5</td>
            </tr>
            <tr>
                <td>3,0</td>
                <td>3,1</td>
                <td>3,2</td>
                <td>3,3</td>
                <td>3,4</td>
                <td>3,5</td>
            </tr>
            <tr>
                <td>4,0</td>
                <td>4,1</td>
                <td>4,2</td>
                <td>4,3</td>
                <td>4,4</td>
                <td>4,5</td>
            </tr>
            <tr>
                <td>5,0</td>
                <td>5,1</td>
                <td>5,2</td>
                <td>5,3</td>
                <td>5,4</td>
                <td>5,5</td>
            </tr>

        </tbody>

    </table>
    <script>
        const table = document.body.children[0];

        [...table.rows].forEach((row, i) => {
            [...row.cells].forEach((cell, j) => {
                console.log(cell, i, j);
                if (i === j) {

                    cell.style.backgroundColor = "red";
                }
                if (i + j === 5) {
                    cell.style.backgroundColor = "red";
                }
            })
        })
        // table.rows[0].cells[0].style.backgroundColor = "red";
    </script>
</body>

</html>